package org.jeecg.modules.qyxx.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.fk.entity.DjNsrxx;
import org.jeecg.modules.qyxx.entity.CompanyInfo;

import java.lang.reflect.Array;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DjLoginUtil {

    /**
     * 设置各表的企业信息
     */
    public static CompanyInfo getLoginCompanyInfo(String jsonStr, String nsrsbh){
        JSONObject jsonObject = JSON.parseObject(jsonStr);
        String nsrsJson = jsonObject.getJSONObject("body").getJSONObject("ssoLoginInfo").getString("nsrs");
        // List list = JSONObject.parseObject(JSONObject.toJSONString(nsrs), List.class);
        List<CompanyInfo> companyInfos = JSON.parseArray(nsrsJson, CompanyInfo.class);
        for (CompanyInfo companyInfo : companyInfos) {
            if (nsrsbh.equals(companyInfo.getGsnsrsbh())){
                return companyInfo;
            }
        }
        // TODO
        return null;
    }
}
